package com.surveillance.entities;

import java.util.List;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "agenda", uniqueConstraints = { @UniqueConstraint(columnNames = { "id" }) })
public class Agenda extends BaseEntity {
	
	@Column(name = "SPECIALITE")
	private boolean isMedecine;// si isMedecine = true donc la specialite est medecine sinon si pharmacie
	@Column(name = "SEMESTRE")
	private int semestre;
	@Column(name = "DATE_DEBUT")
	private Date dateDebut;
	@Column(name = "DATE_FIN")
	private Date dateFin;
	@Column(name = "NIVEAU")
	private String niveau;
	@OneToMany(fetch = FetchType.EAGER, targetEntity = Examen.class)
	private List<Examen> examens;
	@OneToMany(fetch = FetchType.EAGER, targetEntity = Concours.class)
	private Set<Concours> concours = new HashSet<Concours>(0);

	public Agenda() {

	}

	public Agenda(Date dateDebut, Date dateFin, String niveau,
			List examens, Set<Concours> concours) {
		super();
		this.dateDebut = dateDebut;
		this.dateFin = dateFin;
		this.niveau = niveau;
		this.examens = examens;
		this.concours = concours;
	}

	public Date getDateDebut() {
		return dateDebut;
	}

	public void setDateDebut(Date dateDebut) {
		this.dateDebut = dateDebut;
	}

	public Date getDateFin() {
		return dateFin;
	}

	public void setDateFin(Date dateFin) {
		this.dateFin = dateFin;
	}

	public String getNiveau() {
		return niveau;
	}

	public void setNiveau(String niveau) {
		this.niveau = niveau;
	}

	public List<Examen> getExamens() {
		return examens;
	}

	public void setExamens(List<Examen> examens) {
		this.examens = examens;
	}

	public Set<Concours> getConcours() {
		return concours;
	}

	public void setConcours(Set<Concours> concours) {
		this.concours = concours;
	}
	

	public boolean isMedecine() {
		return isMedecine;
	}

	public void setMedecine(boolean isMedecine) {
		this.isMedecine = isMedecine;
	}

	public int getSemestre() {
		return semestre;
	}

	public void setSemestre(int semestre) {
		this.semestre = semestre;
	}

	@Override
	public String toString() {
		return "Agenda [isMedecine=" + isMedecine + ", semestre=" + semestre
				+ ", dateDebut=" + dateDebut + ", dateFin=" + dateFin
				+ ", niveau=" + niveau + ", examens=" + examens + ", concours="
				+ concours + "]";
	}

}
